<template>
  <div id="manage">
     <top></top>
    <el-container>
      <el-container>
        <el-aside width="250px">
          <el-col>
            <el-menu
                default-active="2"
                class="el-menu-vertical-demo"
                background-color="rgb(52,54,90)"
                text-color="#D3d3d3"
                style="height: 90vh"
                active-text-color="#fff">
              <router-link v-for="(menu,index) in menus" :key="index" :to="menu.path">
                <el-submenu :index="index+''">
                  <template slot="title">
                    <i :class="menu.icon"></i>
                    <span slot="index">{{ menu.menuName }}</span>
                  </template>
                  <router-link v-for="(menu1,index1) in menu.secondMenus" :key="index1" :to="menu1.path">
                    <el-menu-item :index="index1+'-'+index">
                      <span slot="title">{{ menu1.menuName }}</span>
                    </el-menu-item>
                  </router-link>
                </el-submenu>
              </router-link>
            </el-menu>
          </el-col>
        </el-aside>
        <el-main style="background-color: rgb(240,242,245)">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
import Top from "./commens/top.vue";

export default ({
  components: {Top},
  data() {
    return {
      menus: [],
      index: '0',
      index1: [],
      index2: [],
    }
  },
  mounted() {
    this.$axios.get("/menu/findAll").then(res => {
      console.log(res.data)
      this.menus = res.data.data
    })
  },
  methods: {}
})
</script>
<style scoped>
#manage {
  margin: 0;
  padding: 0;
}
</style>
